Skip to content

Conversation

@mleleszi
Copy link
Contributor

@mleleszi mleleszi commented Oct 24, 2025

#163091

Remove unistd.faccessat entrypoint for x86 linux if faccessat2 syscall is not available. Tested with non existent symbol and exclusion works.

@mleleszi mleleszi changed the title [libc] Remove faccessat entrypoint if facessat2 syscall is not available [libc] Remove faccessat entrypoint if faccessat2 syscall is not available Oct 24, 2025
@mleleszi mleleszi marked this pull request as ready for review October 24, 2025 07:22
@llvmbot llvmbot added the libc label Oct 24, 2025
@mleleszi
Copy link
Contributor Author

@michaelrj-google Can you please take a look

@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2025

@llvm/pr-subscribers-libc

Author: Marcell Leleszi (mleleszi)

Changes

#163091


Full diff: https://github.com/llvm/llvm-project/pull/164936.diff

2 Files Affected:

  • (modified) libc/CMakeLists.txt (+1-1)
  • (modified) libc/config/linux/x86_64/exclude.txt (+8)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 14718e2090bde..ae555a256ba66 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -363,7 +363,7 @@ elseif(LLVM_LIBC_FULL_BUILD)
   message(FATAL_ERROR "${LIBC_CONFIG_PATH}/headers.txt file not found and fullbuild requested.")
 endif()
 
-# Check exclude.txt that appends to LIBC_EXCLUDE_ENTRYPOINTS list
+# Check exclude.txt that appends to TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS list
 if(EXISTS "${LIBC_CONFIG_PATH}/exclude.txt")
     include("${LIBC_CONFIG_PATH}/exclude.txt")
 endif()
diff --git a/libc/config/linux/x86_64/exclude.txt b/libc/config/linux/x86_64/exclude.txt
index 2c218b753b176..a0686310d21ac 100644
--- a/libc/config/linux/x86_64/exclude.txt
+++ b/libc/config/linux/x86_64/exclude.txt
@@ -19,3 +19,11 @@ if(NOT has_sys_random)
     )
   endif()
 endif()
+
+include(CheckSymbolExists)
+check_symbol_exists(SYS_faccessat2 "sys/syscall.h" HAVE_SYS_FACCESSAT2)
+if(NOT HAVE_SYS_FACCESSAT2)
+  list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
+    libc.src.unistd.faccessat
+  )
+endif()

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we should look into adding this for other architectures as well in a followup

@mleleszi
Copy link
Contributor Author

Will add this for the other archs in a followup. Can you merge this one please?

@michaelrj-google michaelrj-google merged commit b1acd6d into llvm:main Oct 30, 2025
24 checks passed
luciechoi pushed a commit to luciechoi/llvm-project that referenced this pull request Nov 1, 2025
…able (llvm#164936)

[llvm#163091](llvm#163091)

Remove unistd.faccessat entrypoint for x86 linux if faccessat2 syscall
is not available. Tested with non existent symbol and exclusion works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants